<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 基本表单</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="../favicon.ico">
    <link href="/Public/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/Public/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/css/animate.css" rel="stylesheet">
    <link href="/Public/css/style.css?v=4.1.0" rel="stylesheet">

</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>联络中心-
                        <small>创建外呼沟通记录</small>
                    </h5>

                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal" onsubmit="return false">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">*用户名</label>
                            <div class="col-sm-10">
                                <input  class="form-control" type="text" name="name" id="name" placeholder="请输入手机号码" value="<{$name}>"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">*用户手机号码</label>
                            <div class="col-sm-10">
                                <input  class="form-control" type="tel" name="phone" id="phone" placeholder="请输入手机号码" value="<{$mobile}>"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">要求回访时间</label>
                            <div class="col-sm-10">
                                <input class="laydate-icon" id="reply_time"  type="text" value="<{$data.reply_time}>" readonly=""  placeholder="没有要求可以为空"  onclick="layui.laydate({elem: this, istime: false, format: 'YYYY-MM-DD hh:mm'})">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">*事由</label>
                            <div class="col-sm-10">
                                <textarea id="content" name="content"  cols="70" rows="11" placeholder="请描述事由"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">*请选择委托部门</label>
                            <div class="col-sm-10">
                                <select id="apart_id" class="selectBox" >
                                    <volist name="apart" id="vo">
                                        <option value="<{$vo.id}>"><{$vo.name}></option>
                                    </volist>
                                </select>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="button" onclick="back_add()">添加</button>
                                <button class="btn btn-white" type="button" onclick="self.location=document.referrer;">返回</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- 全局js -->
<script src="/Public/js/jquery.min.js?v=2.1.4"></script>
<script src="/Public/js/bootstrap.min.js?v=3.3.6"></script>
<!-- 自定义js -->
<script src="/Public/js/content.js?v=1.0.0"></script>
<script src="/Public/admin/js/layer/layer.js"></script>
<script src="/Public/admin/js/layui/layui.js"></script>
<script src="/Public/admin/js/layui/lay/modules/laydate.js"></script>
<script>

    //回复反馈
    function back_add() {
        //加载loading层
        var index = layer.load(1, {
            shade: [0.1, '#fff'] //0.1透明度的白色背景
        });
        var  content=$("#content").val();
        var  apart_id=$("#apart_id").val();
        var  phone=$("#phone").val();
        var reply_time=$("#reply_time").val();
        var name=$("#name").val();
        var tourl = "<{$SRVER_NAME}>/admin.php/ContactCenter/outbound_record_list";
        var url="<{$SRVER_NAME}>/admin.php/ContactCenter/add_outbound_record";
        var partten = /^(1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9]))\d{8}$/;
        if ( content == "" ) {
            layer.close(index);
            layer.alert("回复不能为空！\r\n", {
                title: '提示框',
                icon: 0,
            });
            return false;
        }
        if (!partten.test(phone)) {
            layer.close(index);
            layer.alert("请输入正确手机号！\r\n", {
                title: '提示框',
                icon:0,
            });
            return false;
            //alert('不是手机号码');
        }
        $.post(url, {content: content, moblie: phone,apart_id:apart_id,reply_time:reply_time,name:name}, function (data) {
            if (data.code =="1001") {
                var test=layer.alert(data.result,{title:'提示框',icon:1},function (index) {
                    self.location=document.referrer;
                    }
                );
            }
            else {
                layer.alert(data.result,{title:'提示框',icon:0});
            }

        });
        layer.close(index);
    }
</script>
</body>
</html>
